<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/vue/2.5.16/vue.js"></script>
    <script src="vue-router.js"></script>
</head>
<body>
    <div id="hd">
        <router-link to="/content">aaa</router-link>
        <router-view></router-view>
    </div>
    <script type="text/x-template" id="tp">
    <div>
        {{$route.params.id}}
        <button @click="test">aaaa</button>
    </div>
</script>
    <script>
        const hd={
            template:'#tp',
            methods:{
                test(){
                    console.log(this.$route.params.id)
                }
            }
        }
        let route=new VueRouter({
            routes:[
                {path:'/content/:id',component:hd}
            ]
        })
        var app=new Vue({
            el:'#hd',
            router:route,
            data:{

            }
        })
    </script>
</body>
</html>